﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        xmlns:models="clr-namespace:FM.时钟.Models" x:Name="window"
        x:Class="FM.时钟.Views.数据编辑视图"
        Title="编辑" Height="500" Width="450">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="100"/>
            <ColumnDefinition Width="10"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <ListView ItemsSource="{Binding 数据列表}" SelectionMode="Single" SelectedIndex="0" SelectedItem="{Binding Model,Mode=OneWayToSource }"   >
            <ListView.ItemTemplate >
                <DataTemplate DataType="models:数据">
                    <TextBlock FontSize="24" Text="{Binding 显示名称}"></TextBlock>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
        <telerik:RadPropertyGrid Grid.Row="0" Grid.Column="2"
                                  IsGrouped="True"
                                 Item="{Binding Model}"
                                 LabelColumnWidth="120"
                                 AutoGeneratePropertyDefinitions="False" >

            <telerik:RadPropertyGrid.PropertyDefinitions>
                <telerik:PropertyDefinition Binding="{Binding 显示文字}"
                                            Description="最终显示的文字"
                                            DisplayName="显示文字"
                                            GroupName="基本" />
                <telerik:PropertyDefinition Binding="{Binding 时间格式}"
                                            Description="显示的时间格式 年y 月M 日d 时H 分m 秒s 周dddd"
                                            DisplayName="时间格式"
                                            GroupName="基本" />
                <telerik:PropertyDefinition Binding="{Binding 字体名称}"
                                            Description="字体名称"
                                            DisplayName="字体名称"
                                            GroupName="基本" />
                <telerik:PropertyDefinition Binding="{Binding 字体颜色}"
                                            Description="字体颜色"
                                            DisplayName="字体颜色"
                                            GroupName="基本" >
                    <!--<telerik:PropertyDefinition.EditorTemplate>
                        <DataTemplate>
                            <telerik:RadColorEditor SelectedColor="{Binding Value}" />
                        </DataTemplate>
                    </telerik:PropertyDefinition.EditorTemplate>-->
                </telerik:PropertyDefinition>
                <telerik:PropertyDefinition Binding="{Binding 字体大小}"
                                            Description="字体大小"
                                            DisplayName="字体大小"
                                            GroupName="基本" />
                <telerik:PropertyDefinition Binding="{Binding 定时刷新}"
                                            Description="是否定时刷新"
                                            DisplayName="定时刷新"
                                            GroupName="定时" />

                <telerik:PropertyDefinition Binding="{Binding 定时刷新毫秒}"
                                            Description="定时刷新毫秒:1秒=1000毫秒"
                                            DisplayName="定时刷新毫秒"
                                            GroupName="定时" />
            </telerik:RadPropertyGrid.PropertyDefinitions>
        </telerik:RadPropertyGrid>


        <Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Height="75">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <Button Content="确定" Margin="10,5" Width="100" Height="40" HorizontalAlignment="Center" VerticalAlignment="Center" Command="{Binding 确定Command}" CommandParameter="{Binding ElementName=window, Mode=OneWay}"></Button>
            <Button Grid.Column="1" Content="取消" Margin="10,5" Width="100" Height="40" HorizontalAlignment="Center" VerticalAlignment="Center"  Command="{Binding 取消Command}"  CommandParameter="{Binding ElementName=window, Mode=OneWay}"></Button>

        </Grid>
    </Grid>
</Window>
